package com.fjec.market.schedule.handler;

import com.fjec.market.service.IBizPhysicalOrderService;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

@Component
public class AutoSignHandler {

    @Resource
    private IBizPhysicalOrderService bizPhysicalOrderService;

    public String handle(int limit, int minutes) {
        StringBuilder sb = new StringBuilder();
        List<Long> subOrderIds = bizPhysicalOrderService.getLongTimeUnsignedSubOrders(limit);
        subOrderIds.forEach(id -> {
            bizPhysicalOrderService.subOrderAutoSigned(id);
            sb.append("子订单 " + id + " 发货超过5天买家未收货，系统已自动收货\n");
        });
        return sb.toString();
    }
}
